#ifndef DATACOLLECT_EEG2_H
#define DATACOLLECT_EEG2_H

#include <HotPlot.h>
#include <QCustomPlot.h>
#include <QWidget>

#include <SeriaPortWork/serialworker.h>

#include <charts/singcustomwave.h>

namespace Ui {
class DataCollect_EEG2;
}

class DataCollect_EEG2 : public QWidget
{
    Q_OBJECT

public:
    explicit DataCollect_EEG2(QWidget *parent = nullptr);
    ~DataCollect_EEG2();


private slots:
    void on_pb_close_clicked();

    void handleEEGWaveData(QVector<double> leftEEGdata, QVector<double> rightEEGdata, QVector<double> irdata, QVector<double> reddata);
    void on_pushButton_clicked();

    void handleError(const QString &error);
    void serialStartWork();
    void on_pushButton_2_clicked();

    void handleEEGRealIndexData(QVector<double> EEGIndexdata);
    void handleEEGEnergyIndexData(QVector<double> engeryIndex, QVector<double> f, QVector<double> psd);
private:
    Ui::DataCollect_EEG2 *ui;
    QCustomPlot *customPlot_leftEEG,*customPlot_rightEEG,*customPlot_ir,*customPlot_red;
    SingCustomWave *scw_leftEEG,*scw_rightEEG,*scw_ir,*scw_red;
    QThread *m_thread;
    SerialWorker *m_worker;
    void setupSerialThread();
    void setupUI();
    HotPlot *hp_delta,*hp_theta,*hp_alpha,*hp_beta,*hp_gamma;
};

#endif // DATACOLLECT_EEG2_H
